/*
               File: Carne_BC
        Description: Carne
             Author: GeneXus C# Generator version 10_2_1-58381
       Generated on: 8/28/2012 20:58:58.56
       Program type: Callable routine
          Main DBMS: sqlserver
*/
using System;
using System.Collections;
using GeneXus.Utils;
using GeneXus.Resources;
using GeneXus.Application;
using GeneXus.Metadata;
using System.Data;
using System.Data.SqlClient;
using GeneXus.Data;
using com.genexus;
using GeneXus.Data.ADO;
using GeneXus.Data.NTier;
using GeneXus.Data.NTier.ADO;
using System.Runtime.Remoting;
using GeneXus.WebControls;
using GeneXus.Http;
using GeneXus.XML;
using GeneXus.Search;
using GeneXus.Encryption;
using GeneXus.Http.Client;
using System.Xml.Serialization;
using System.Data.SqlTypes;
using System.ServiceModel;
using System.Runtime.Serialization;
namespace GeneXus.Programs {
   public class carne_bc : GXHttpHandler, IGxSilentTrn
   {
      public carne_bc( )
      {
         context = new GxContext(  );
         DataStoreUtil.LoadDataStores( context);
         dsDefault = context.GetDataStore("Default") ;
         IsMain = true;
         context.SetDefaultTheme("GeneXusXEv2");
      }

      public carne_bc( IGxContext context )
      {
         this.context = context;
         IsMain = false;
         dsDefault = context.GetDataStore("Default") ;
      }

      protected void INITTRN( )
      {
      }

      public void GetInsDefault( )
      {
         ReadRow033( ) ;
         standaloneNotModal( ) ;
         InitializeNonKey033( ) ;
         standaloneModal( ) ;
         AddRow033( ) ;
         return  ;
      }

      protected void AfterTrn( )
      {
         if ( trnEnded == 1 )
         {
            /* Execute user event: E11032 */
            E11032 ();
            trnEnded = 0 ;
            standaloneNotModal( ) ;
            standaloneModal( ) ;
            if ( ( StringUtil.StrCmp(Gx_mode, "INS") == 0 )  )
            {
               Z8CarneId = A8CarneId ;
               SetMode( "UPD") ;
            }
         }
      }

      public override String ToString( )
      {
         return "" ;
      }

      public GxContentInfo GetContentInfo( )
      {
         return (GxContentInfo)(null) ;
      }

      public bool Reindex( )
      {
         return true ;
      }

      protected void CONFIRM_030( )
      {
         BeforeValidate033( ) ;
         if ( AnyError == 0 )
         {
            if ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 )
            {
               OnDeleteControls033( ) ;
            }
            else
            {
               CheckExtendedTable033( ) ;
               if ( AnyError == 0 )
               {
                  ZM033( 2) ;
               }
               CloseExtendedTableCursors033( ) ;
            }
         }
         if ( AnyError == 0 )
         {
            IsConfirmed = 1 ;
         }
      }

      protected void E12032( )
      {
         /* Start Routine */
      }

      protected void E11032( )
      {
         /* After Trn Routine */
      }

      protected void ZM033( short GX_JID )
      {
         if ( ( GX_JID == 1 ) || ( GX_JID == 0 ) )
         {
            Z9CarneNombre = A9CarneNombre ;
            Z3PeriodistaId = A3PeriodistaId ;
         }
         if ( ( GX_JID == 2 ) || ( GX_JID == 0 ) )
         {
         }
         if ( GX_JID == -1 )
         {
            Z8CarneId = A8CarneId ;
            Z9CarneNombre = A9CarneNombre ;
            Z3PeriodistaId = A3PeriodistaId ;
         }
      }

      protected void standaloneNotModal( )
      {
      }

      protected void standaloneModal( )
      {
      }

      protected void Load033( )
      {
         /* Using cursor BC00035 */
         pr_default.execute(3, new Object[] {A8CarneId});
         if ( (pr_default.getStatus(3) != 101) )
         {
            RcdFound3 = 1 ;
            A9CarneNombre = BC00035_A9CarneNombre[0] ;
            A3PeriodistaId = BC00035_A3PeriodistaId[0] ;
            ZM033( -1) ;
         }
         pr_default.close(3);
         OnLoadActions033( ) ;
      }

      protected void OnLoadActions033( )
      {
      }

      protected void CheckExtendedTable033( )
      {
         standaloneModal( ) ;
         /* Using cursor BC00034 */
         pr_default.execute(2, new Object[] {A3PeriodistaId});
         if ( (pr_default.getStatus(2) == 101) )
         {
            AnyError3 = 1 ;
            GX_msglist.addItem("No existe 'Periodista'.", "ForeignKeyNotFound", 1, "PERIODISTAID");
            AnyError = 1 ;
         }
         if ( AnyError3 == 0 )
         {
         }
         pr_default.close(2);
      }

      protected void CloseExtendedTableCursors033( )
      {
         pr_default.close(2);
      }

      protected void enableDisable( )
      {
      }

      protected void GetKey033( )
      {
         /* Using cursor BC00036 */
         pr_default.execute(4, new Object[] {A8CarneId});
         if ( (pr_default.getStatus(4) != 101) )
         {
            RcdFound3 = 1 ;
         }
         else
         {
            RcdFound3 = 0 ;
         }
         pr_default.close(4);
      }

      protected void getByPrimaryKey( )
      {
         /* Using cursor BC00033 */
         pr_default.execute(1, new Object[] {A8CarneId});
         if ( (pr_default.getStatus(1) != 101) )
         {
            ZM033( 1) ;
            RcdFound3 = 1 ;
            A8CarneId = BC00033_A8CarneId[0] ;
            A9CarneNombre = BC00033_A9CarneNombre[0] ;
            A3PeriodistaId = BC00033_A3PeriodistaId[0] ;
            Z8CarneId = A8CarneId ;
            sMode3 = Gx_mode ;
            Gx_mode = "" ;
            standaloneModal( ) ;
            Load033( ) ;
            Gx_mode = sMode3 ;
         }
         else
         {
            RcdFound3 = 0 ;
            InitializeNonKey033( ) ;
            sMode3 = Gx_mode ;
            Gx_mode = "" ;
            standaloneModal( ) ;
            Gx_mode = sMode3 ;
         }
         pr_default.close(1);
      }

      protected void getEqualNoModal( )
      {
         GetKey033( ) ;
         if ( RcdFound3 == 0 )
         {
            Gx_mode = "INS" ;
         }
         else
         {
            Gx_mode = "UPD" ;
         }
         getByPrimaryKey( ) ;
      }

      protected void insert_Check( )
      {
         CONFIRM_030( ) ;
         IsConfirmed = 0 ;
      }

      protected void update_Check( )
      {
         insert_Check( ) ;
      }

      protected void delete_Check( )
      {
         insert_Check( ) ;
      }

      protected void CheckOptimisticConcurrency033( )
      {
         if ( StringUtil.StrCmp(Gx_mode, "INS") != 0 )
         {
            /* Using cursor BC00032 */
            pr_default.execute(0, new Object[] {A8CarneId});
            if ( (pr_default.getStatus(0) == 103) )
            {
               GX_msglist.addItem(context.GetMessage( "GXM_lock", new   object[]  {"Carne"}), "RecordIsLocked", 1, "");
               AnyError = 1 ;
               return  ;
            }
            if ( (pr_default.getStatus(0) == 101) || ( StringUtil.StrCmp(Z9CarneNombre, BC00032_A9CarneNombre[0]) != 0 ) || ( Z3PeriodistaId != BC00032_A3PeriodistaId[0] ) )
            {
               GX_msglist.addItem(context.GetMessage( "GXM_waschg", new   object[]  {"Carne"}), "RecordWasChanged", 1, "");
               AnyError = 1 ;
               return  ;
            }
         }
      }

      protected void Insert033( )
      {
         BeforeValidate033( ) ;
         if ( AnyError == 0 )
         {
            CheckExtendedTable033( ) ;
         }
         if ( AnyError == 0 )
         {
            ZM033( 0) ;
            CheckOptimisticConcurrency033( ) ;
            if ( AnyError == 0 )
            {
               AfterConfirm033( ) ;
               if ( AnyError == 0 )
               {
                  BeforeInsert033( ) ;
                  if ( AnyError == 0 )
                  {
                     /* Using cursor BC00037 */
                     pr_default.execute(5, new Object[] {A9CarneNombre, A3PeriodistaId});
                     pr_default.close(5);
                     /* Retrieving last key number assigned */
                     /* Using cursor BC00038 */
                     pr_default.execute(6);
                     A8CarneId = BC00038_A8CarneId[0] ;
                     pr_default.close(6);
                     dsDefault.SmartCacheProvider.SetUpdated("Carne") ;
                     if ( AnyError == 0 )
                     {
                        /* Start of After( Insert) rules */
                        /* End of After( Insert) rules */
                        if ( AnyError == 0 )
                        {
                           /* Save values for previous() function. */
                           GX_msglist.addItem(context.GetMessage( "GXM_sucadded", ""), 0, "");
                        }
                     }
                  }
                  else
                  {
                     GX_msglist.addItem(context.GetMessage( "GXM_unexp", ""), 1, "");
                     AnyError = 1 ;
                  }
               }
            }
            else
            {
               Load033( ) ;
            }
            EndLevel033( ) ;
         }
         CloseExtendedTableCursors033( ) ;
      }

      protected void Update033( )
      {
         BeforeValidate033( ) ;
         if ( AnyError == 0 )
         {
            CheckExtendedTable033( ) ;
         }
         if ( AnyError == 0 )
         {
            CheckOptimisticConcurrency033( ) ;
            if ( AnyError == 0 )
            {
               AfterConfirm033( ) ;
               if ( AnyError == 0 )
               {
                  BeforeUpdate033( ) ;
                  if ( AnyError == 0 )
                  {
                     /* Using cursor BC00039 */
                     pr_default.execute(7, new Object[] {A9CarneNombre, A3PeriodistaId, A8CarneId});
                     pr_default.close(7);
                     dsDefault.SmartCacheProvider.SetUpdated("Carne") ;
                     if ( (pr_default.getStatus(7) == 103) )
                     {
                        GX_msglist.addItem(context.GetMessage( "GXM_lock", new   object[]  {"Carne"}), "RecordIsLocked", 1, "");
                        AnyError = 1 ;
                     }
                     DeferredUpdate033( ) ;
                     if ( AnyError == 0 )
                     {
                        /* Start of After( update) rules */
                        /* End of After( update) rules */
                        if ( AnyError == 0 )
                        {
                           getByPrimaryKey( ) ;
                           GX_msglist.addItem(context.GetMessage( "GXM_sucupdated", ""), 0, "");
                        }
                     }
                     else
                     {
                        GX_msglist.addItem(context.GetMessage( "GXM_unexp", ""), 1, "");
                        AnyError = 1 ;
                     }
                  }
               }
            }
            EndLevel033( ) ;
         }
         CloseExtendedTableCursors033( ) ;
      }

      protected void DeferredUpdate033( )
      {
      }

      protected void delete( )
      {
         Gx_mode = "DLT" ;
         BeforeValidate033( ) ;
         if ( AnyError == 0 )
         {
            CheckOptimisticConcurrency033( ) ;
         }
         if ( AnyError == 0 )
         {
            OnDeleteControls033( ) ;
            AfterConfirm033( ) ;
            if ( AnyError == 0 )
            {
               BeforeDelete033( ) ;
               if ( AnyError == 0 )
               {
                  /* No cascading delete specified. */
                  /* Using cursor BC000310 */
                  pr_default.execute(8, new Object[] {A8CarneId});
                  pr_default.close(8);
                  dsDefault.SmartCacheProvider.SetUpdated("Carne") ;
                  if ( AnyError == 0 )
                  {
                     /* Start of After( delete) rules */
                     /* End of After( delete) rules */
                     if ( AnyError == 0 )
                     {
                        GX_msglist.addItem(context.GetMessage( "GXM_sucdeleted", ""), 0, "");
                     }
                  }
                  else
                  {
                     GX_msglist.addItem(context.GetMessage( "GXM_unexp", ""), 1, "");
                     AnyError = 1 ;
                  }
               }
            }
         }
         sMode3 = Gx_mode ;
         Gx_mode = "DLT" ;
         EndLevel033( ) ;
         Gx_mode = sMode3 ;
      }

      protected void OnDeleteControls033( )
      {
         standaloneModal( ) ;
         /* No delete mode formulas found. */
      }

      protected void EndLevel033( )
      {
         if ( StringUtil.StrCmp(Gx_mode, "INS") != 0 )
         {
            pr_default.close(0);
         }
         if ( AnyError == 0 )
         {
            BeforeComplete033( ) ;
         }
         if ( AnyError == 0 )
         {
            /* After transaction rules */
            /* Execute 'After Trn' event if defined. */
            trnEnded = 1 ;
         }
         else
         {
         }
         IsModified = 0 ;
         if ( AnyError != 0 )
         {
            context.wjLoc = "" ;
            context.nUserReturn = 0 ;
         }
      }

      public void ScanKeyStart033( )
      {
         /* Scan By routine */
         /* Using cursor BC000311 */
         pr_default.execute(9, new Object[] {A8CarneId});
         RcdFound3 = 0 ;
         if ( (pr_default.getStatus(9) != 101) )
         {
            RcdFound3 = 1 ;
            A8CarneId = BC000311_A8CarneId[0] ;
            A9CarneNombre = BC000311_A9CarneNombre[0] ;
            A3PeriodistaId = BC000311_A3PeriodistaId[0] ;
         }
         /* Load Subordinate Levels */
      }

      protected void ScanKeyNext033( )
      {
         /* Scan next routine */
         pr_default.readNext(9);
         RcdFound3 = 0 ;
         ScanKeyLoad033( ) ;
      }

      protected void ScanKeyLoad033( )
      {
         sMode3 = Gx_mode ;
         Gx_mode = "DSP" ;
         if ( (pr_default.getStatus(9) != 101) )
         {
            RcdFound3 = 1 ;
            A8CarneId = BC000311_A8CarneId[0] ;
            A9CarneNombre = BC000311_A9CarneNombre[0] ;
            A3PeriodistaId = BC000311_A3PeriodistaId[0] ;
         }
         Gx_mode = sMode3 ;
      }

      protected void ScanKeyEnd033( )
      {
         pr_default.close(9);
      }

      protected void AfterConfirm033( )
      {
         /* After Confirm Rules */
      }

      protected void BeforeInsert033( )
      {
         /* Before Insert Rules */
      }

      protected void BeforeUpdate033( )
      {
         /* Before Update Rules */
      }

      protected void BeforeDelete033( )
      {
         /* Before Delete Rules */
      }

      protected void BeforeComplete033( )
      {
         /* Before Complete Rules */
      }

      protected void BeforeValidate033( )
      {
         /* Before Validate Rules */
      }

      protected void DisableAttributes033( )
      {
      }

      protected void AddRow033( )
      {
         VarsToRow3( bcCarne) ;
      }

      protected void ReadRow033( )
      {
         RowToVars3( bcCarne, 1) ;
      }

      protected void InitializeNonKey033( )
      {
         A9CarneNombre = "" ;
         A3PeriodistaId = 0 ;
      }

      protected void InitAll033( )
      {
         A8CarneId = 0 ;
         InitializeNonKey033( ) ;
      }

      protected void StandaloneModalInsert( )
      {
      }

      public void VarsToRow3( SdtCarne obj3 )
      {
         obj3.gxTpr_Mode = Gx_mode ;
         obj3.gxTpr_Carnenombre = A9CarneNombre ;
         obj3.gxTpr_Periodistaid = A3PeriodistaId ;
         obj3.gxTpr_Carneid = A8CarneId ;
         obj3.gxTpr_Carneid_Z = Z8CarneId ;
         obj3.gxTpr_Carnenombre_Z = Z9CarneNombre ;
         obj3.gxTpr_Periodistaid_Z = Z3PeriodistaId ;
         obj3.gxTpr_Mode = Gx_mode ;
         return  ;
      }

      public void RowToVars3( SdtCarne obj3 ,
                              int forceLoad )
      {
         Gx_mode = obj3.gxTpr_Mode ;
         A9CarneNombre = obj3.gxTpr_Carnenombre ;
         A3PeriodistaId = obj3.gxTpr_Periodistaid ;
         A8CarneId = obj3.gxTpr_Carneid ;
         Z8CarneId = obj3.gxTpr_Carneid_Z ;
         Z9CarneNombre = obj3.gxTpr_Carnenombre_Z ;
         Z3PeriodistaId = obj3.gxTpr_Periodistaid_Z ;
         Gx_mode = obj3.gxTpr_Mode ;
         return  ;
      }

      public void LoadKey( Object[] obj )
      {
         BackMsgLst = context.GX_msglist ;
         context.GX_msglist = LclMsgLst ;
         A8CarneId = (short)getParm(obj,0) ;
         AnyError = 0 ;
         context.GX_msglist.removeAllItems();
         InitializeNonKey033( ) ;
         ScanKeyStart033( ) ;
         if ( RcdFound3 == 0 )
         {
            Gx_mode = "INS" ;
         }
         else
         {
            Gx_mode = "UPD" ;
            Z8CarneId = A8CarneId ;
         }
         ZM033( -1) ;
         sMode3 = Gx_mode ;
         Gx_mode = "DSP" ;
         OnLoadActions033( ) ;
         Gx_mode = sMode3 ;
         AddRow033( ) ;
         ScanKeyEnd033( ) ;
         if ( RcdFound3 == 0 )
         {
            GX_msglist.addItem(context.GetMessage( "GXM_keynfound", ""), "PrimaryKeyNotFound", 1, "");
            AnyError = 1 ;
         }
         context.GX_msglist = BackMsgLst ;
      }

      public void Load( )
      {
      }

      public void Save( )
      {
         BackMsgLst = context.GX_msglist ;
         context.GX_msglist = LclMsgLst ;
         AnyError = 0 ;
         context.GX_msglist.removeAllItems();
         IsConfirmed = 1 ;
         RowToVars3( bcCarne, 0) ;
         nKeyPressed = 1 ;
         GetKey033( ) ;
         if ( RcdFound3 == 1 )
         {
            if ( StringUtil.StrCmp(Gx_mode, "INS") == 0 )
            {
               GX_msglist.addItem(context.GetMessage( "GXM_noupdate", ""), "DuplicatePrimaryKey", 1, "");
               AnyError = 1 ;
            }
            else if ( A8CarneId != Z8CarneId )
            {
               A8CarneId = Z8CarneId ;
               GX_msglist.addItem(context.GetMessage( "GXM_getbeforeupd", ""), "CandidateKeyNotFound", 1, "");
               AnyError = 1 ;
            }
            else if ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 )
            {
               delete( ) ;
               AfterTrn( ) ;
            }
            else
            {
               Gx_mode = "UPD" ;
               /* Update record */
               Update033( ) ;
            }
         }
         else
         {
            if ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 )
            {
               GX_msglist.addItem(context.GetMessage( "GXM_getbeforeupd", ""), "CandidateKeyNotFound", 1, "");
               AnyError = 1 ;
            }
            else
            {
               if ( A8CarneId != Z8CarneId )
               {
                  if ( StringUtil.StrCmp(Gx_mode, "UPD") == 0 )
                  {
                     GX_msglist.addItem(context.GetMessage( "GXM_getbeforeupd", ""), "DuplicatePrimaryKey", 1, "");
                     AnyError = 1 ;
                  }
                  else
                  {
                     Gx_mode = "INS" ;
                     /* Insert record */
                     Insert033( ) ;
                  }
               }
               else
               {
                  if ( StringUtil.StrCmp(Gx_mode, "UPD") == 0 )
                  {
                     GX_msglist.addItem(context.GetMessage( "GXM_recdeleted", ""), 1, "");
                     AnyError = 1 ;
                  }
                  else
                  {
                     Gx_mode = "INS" ;
                     /* Insert record */
                     Insert033( ) ;
                  }
               }
            }
         }
         AfterTrn( ) ;
         VarsToRow3( bcCarne) ;
         context.GX_msglist = BackMsgLst ;
         return  ;
      }

      public void Check( )
      {
         BackMsgLst = context.GX_msglist ;
         context.GX_msglist = LclMsgLst ;
         AnyError = 0 ;
         context.GX_msglist.removeAllItems();
         RowToVars3( bcCarne, 0) ;
         nKeyPressed = 3 ;
         IsConfirmed = 0 ;
         GetKey033( ) ;
         if ( RcdFound3 == 1 )
         {
            if ( StringUtil.StrCmp(Gx_mode, "INS") == 0 )
            {
               GX_msglist.addItem(context.GetMessage( "GXM_noupdate", ""), "DuplicatePrimaryKey", 1, "");
               AnyError = 1 ;
            }
            else if ( A8CarneId != Z8CarneId )
            {
               A8CarneId = Z8CarneId ;
               GX_msglist.addItem(context.GetMessage( "GXM_getbeforeupd", ""), "DuplicatePrimaryKey", 1, "");
               AnyError = 1 ;
            }
            else if ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 )
            {
               delete_Check( ) ;
            }
            else
            {
               Gx_mode = "UPD" ;
               update_Check( ) ;
            }
         }
         else
         {
            if ( A8CarneId != Z8CarneId )
            {
               Gx_mode = "INS" ;
               insert_Check( ) ;
            }
            else
            {
               if ( StringUtil.StrCmp(Gx_mode, "UPD") == 0 )
               {
                  GX_msglist.addItem(context.GetMessage( "GXM_recdeleted", ""), 1, "");
                  AnyError = 1 ;
               }
               else
               {
                  Gx_mode = "INS" ;
                  insert_Check( ) ;
               }
            }
         }
         pr_default.close(1);
         context.RollbackDataStores("Carne_BC");
         VarsToRow3( bcCarne) ;
         context.GX_msglist = BackMsgLst ;
         return  ;
      }

      public int Errors( )
      {
         if ( AnyError == 0 )
         {
            return (int)(0) ;
         }
         return (int)(1) ;
      }

      public msglist GetMessages( )
      {
         return LclMsgLst ;
      }

      public String GetMode( )
      {
         Gx_mode = bcCarne.gxTpr_Mode ;
         return Gx_mode ;
      }

      public void SetMode( String lMode )
      {
         Gx_mode = lMode ;
         bcCarne.gxTpr_Mode = Gx_mode ;
         return  ;
      }

      public void SetSDT( GxSilentTrnSdt sdt ,
                          short sdtToBc )
      {
         if ( sdt != bcCarne )
         {
            bcCarne = (SdtCarne)(sdt) ;
            if ( StringUtil.StrCmp(bcCarne.gxTpr_Mode, "") == 0 )
            {
               bcCarne.gxTpr_Mode = "INS" ;
            }
            if ( sdtToBc == 1 )
            {
               VarsToRow3( bcCarne) ;
            }
            else
            {
               RowToVars3( bcCarne, 1) ;
            }
         }
         else
         {
            if ( StringUtil.StrCmp(bcCarne.gxTpr_Mode, "") == 0 )
            {
               bcCarne.gxTpr_Mode = "INS" ;
            }
         }
         return  ;
      }

      public void ReloadFromSDT( )
      {
         RowToVars3( bcCarne, 1) ;
         return  ;
      }

      public SdtCarne Carne_BC
      {
         get {
            return bcCarne ;
         }

      }

      public override void webExecute( )
      {
         createObjects();
         initialize();
      }

      protected override void createObjects( )
      {
      }

      protected void Process( )
      {
      }

      public void cleanup( )
      {
         flushBuffer();
         CloseOpenCursors();
         if ( IsMain )
         {
            context.CloseConnections() ;
         }
      }

      protected void CloseOpenCursors( )
      {
         pr_default.close(1);
      }

      public override void initialize( )
      {
         scmdbuf = "" ;
         PreviousTooltip = "" ;
         PreviousCaption = "" ;
         Gx_mode = "" ;
         Z9CarneNombre = "" ;
         A9CarneNombre = "" ;
         BC00035_A8CarneId = new short[1] ;
         BC00035_A9CarneNombre = new String[] {""} ;
         BC00035_A3PeriodistaId = new short[1] ;
         BC00034_A3PeriodistaId = new short[1] ;
         BC00036_A8CarneId = new short[1] ;
         BC00033_A8CarneId = new short[1] ;
         BC00033_A9CarneNombre = new String[] {""} ;
         BC00033_A3PeriodistaId = new short[1] ;
         sMode3 = "" ;
         BC00032_A8CarneId = new short[1] ;
         BC00032_A9CarneNombre = new String[] {""} ;
         BC00032_A3PeriodistaId = new short[1] ;
         BC00038_A8CarneId = new short[1] ;
         BC000311_A8CarneId = new short[1] ;
         BC000311_A9CarneNombre = new String[] {""} ;
         BC000311_A3PeriodistaId = new short[1] ;
         BackMsgLst = new msglist();
         LclMsgLst = new msglist();
         pr_default = new DataStoreProvider(context, new GeneXus.Programs.carne_bc__default(),
            new Object[][] {
                new Object[] {
               BC00032_A8CarneId, BC00032_A9CarneNombre, BC00032_A3PeriodistaId
               }
               , new Object[] {
               BC00033_A8CarneId, BC00033_A9CarneNombre, BC00033_A3PeriodistaId
               }
               , new Object[] {
               BC00034_A3PeriodistaId
               }
               , new Object[] {
               BC00035_A8CarneId, BC00035_A9CarneNombre, BC00035_A3PeriodistaId
               }
               , new Object[] {
               BC00036_A8CarneId
               }
               , new Object[] {
               }
               , new Object[] {
               BC00038_A8CarneId
               }
               , new Object[] {
               }
               , new Object[] {
               }
               , new Object[] {
               BC000311_A8CarneId, BC000311_A9CarneNombre, BC000311_A3PeriodistaId
               }
            }
         );
         INITTRN();
         /* Execute Start event if defined. */
         /* Execute user event: E12032 */
         E12032 ();
      }

      private short IsConfirmed ;
      private short IsModified ;
      private short AnyError ;
      private short nKeyPressed ;
      private short Z8CarneId ;
      private short A8CarneId ;
      private short GX_JID ;
      private short Z3PeriodistaId ;
      private short A3PeriodistaId ;
      private short RcdFound3 ;
      private int trnEnded ;
      private int AnyError3 ;
      private String scmdbuf ;
      private String PreviousTooltip ;
      private String PreviousCaption ;
      private String Gx_mode ;
      private String sMode3 ;
      private String Z9CarneNombre ;
      private String A9CarneNombre ;
      private SdtCarne bcCarne ;
      private IGxDataStore dsDefault ;
      private IDataStoreProvider pr_default ;
      private short[] BC00035_A8CarneId ;
      private String[] BC00035_A9CarneNombre ;
      private short[] BC00035_A3PeriodistaId ;
      private short[] BC00034_A3PeriodistaId ;
      private short[] BC00036_A8CarneId ;
      private short[] BC00033_A8CarneId ;
      private String[] BC00033_A9CarneNombre ;
      private short[] BC00033_A3PeriodistaId ;
      private short[] BC00032_A8CarneId ;
      private String[] BC00032_A9CarneNombre ;
      private short[] BC00032_A3PeriodistaId ;
      private short[] BC00038_A8CarneId ;
      private short[] BC000311_A8CarneId ;
      private String[] BC000311_A9CarneNombre ;
      private short[] BC000311_A3PeriodistaId ;
      private msglist BackMsgLst ;
      private msglist LclMsgLst ;
   }

   public class carne_bc__default : DataStoreHelperBase, IDataStoreHelper
   {
      public ICursor[] getCursors( )
      {
         cursorDefinitions();
         return new Cursor[] {
          new ForEachCursor(def[0])
         ,new ForEachCursor(def[1])
         ,new ForEachCursor(def[2])
         ,new ForEachCursor(def[3])
         ,new ForEachCursor(def[4])
         ,new UpdateCursor(def[5])
         ,new ForEachCursor(def[6])
         ,new UpdateCursor(def[7])
         ,new UpdateCursor(def[8])
         ,new ForEachCursor(def[9])
       };
    }

    private static CursorDef[] def;
    private void cursorDefinitions( )
    {
       if ( def == null )
       {
          Object[] prmBC00035 ;
          prmBC00035 = new Object[] {
          new Object[] {"@CarneId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmBC00034 ;
          prmBC00034 = new Object[] {
          new Object[] {"@PeriodistaId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmBC00036 ;
          prmBC00036 = new Object[] {
          new Object[] {"@CarneId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmBC00033 ;
          prmBC00033 = new Object[] {
          new Object[] {"@CarneId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmBC00032 ;
          prmBC00032 = new Object[] {
          new Object[] {"@CarneId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmBC00037 ;
          prmBC00037 = new Object[] {
          new Object[] {"@CarneNombre",SqlDbType.VarChar,40,0} ,
          new Object[] {"@PeriodistaId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmBC00038 ;
          prmBC00038 = new Object[] {
          } ;
          Object[] prmBC00039 ;
          prmBC00039 = new Object[] {
          new Object[] {"@CarneNombre",SqlDbType.VarChar,40,0} ,
          new Object[] {"@PeriodistaId",SqlDbType.SmallInt,4,0} ,
          new Object[] {"@CarneId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmBC000310 ;
          prmBC000310 = new Object[] {
          new Object[] {"@CarneId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmBC000311 ;
          prmBC000311 = new Object[] {
          new Object[] {"@CarneId",SqlDbType.SmallInt,4,0}
          } ;
          def= new CursorDef[] {
              new CursorDef("BC00032", "SELECT [CarneId], [CarneNombre], [PeriodistaId] FROM [Carne] WITH (UPDLOCK) WHERE [CarneId] = @CarneId ",true, GxErrorMask.GX_NOMASK, false, this,prmBC00032,1,0,true,false )
             ,new CursorDef("BC00033", "SELECT [CarneId], [CarneNombre], [PeriodistaId] FROM [Carne] WITH (NOLOCK) WHERE [CarneId] = @CarneId ",true, GxErrorMask.GX_NOMASK, false, this,prmBC00033,1,0,true,false )
             ,new CursorDef("BC00034", "SELECT [PeriodistaId] FROM [Periodista] WITH (NOLOCK) WHERE [PeriodistaId] = @PeriodistaId ",true, GxErrorMask.GX_NOMASK, false, this,prmBC00034,1,0,true,false )
             ,new CursorDef("BC00035", "SELECT TM1.[CarneId], TM1.[CarneNombre], TM1.[PeriodistaId] FROM [Carne] TM1 WITH (NOLOCK) WHERE TM1.[CarneId] = @CarneId ORDER BY TM1.[CarneId]  OPTION (FAST 100)",true, GxErrorMask.GX_NOMASK, false, this,prmBC00035,100,0,true,false )
             ,new CursorDef("BC00036", "SELECT [CarneId] FROM [Carne] WITH (NOLOCK) WHERE [CarneId] = @CarneId  OPTION (FAST 1)",true, GxErrorMask.GX_NOMASK, false, this,prmBC00036,1,0,true,false )
             ,new CursorDef("BC00037", "INSERT INTO [Carne] ([CarneNombre], [PeriodistaId]) VALUES (@CarneNombre, @PeriodistaId)", GxErrorMask.GX_NOMASK,prmBC00037)
             ,new CursorDef("BC00038", "SELECT Ident_Current('[Carne]') ",true, GxErrorMask.GX_NOMASK, false, this,prmBC00038,1,0,true,false )
             ,new CursorDef("BC00039", "UPDATE [Carne] SET [CarneNombre]=@CarneNombre, [PeriodistaId]=@PeriodistaId  WHERE [CarneId] = @CarneId", GxErrorMask.GX_NOMASK,prmBC00039)
             ,new CursorDef("BC000310", "DELETE FROM [Carne]  WHERE [CarneId] = @CarneId", GxErrorMask.GX_NOMASK,prmBC000310)
             ,new CursorDef("BC000311", "SELECT TM1.[CarneId], TM1.[CarneNombre], TM1.[PeriodistaId] FROM [Carne] TM1 WITH (NOLOCK) WHERE TM1.[CarneId] = @CarneId ORDER BY TM1.[CarneId]  OPTION (FAST 100)",true, GxErrorMask.GX_NOMASK, false, this,prmBC000311,100,0,true,false )
          };
       }
    }

    public void getResults( int cursor ,
                            IFieldGetter rslt ,
                            Object[] buf )
    {
       switch ( cursor )
       {
             case 0 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((String[]) buf[1])[0] = rslt.getVarchar(2) ;
                ((short[]) buf[2])[0] = rslt.getShort(3) ;
                break;
             case 1 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((String[]) buf[1])[0] = rslt.getVarchar(2) ;
                ((short[]) buf[2])[0] = rslt.getShort(3) ;
                break;
             case 2 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                break;
             case 3 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((String[]) buf[1])[0] = rslt.getVarchar(2) ;
                ((short[]) buf[2])[0] = rslt.getShort(3) ;
                break;
             case 4 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                break;
             case 6 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                break;
             case 9 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((String[]) buf[1])[0] = rslt.getVarchar(2) ;
                ((short[]) buf[2])[0] = rslt.getShort(3) ;
                break;
       }
    }

    public void setParameters( int cursor ,
                               IFieldSetter stmt ,
                               Object[] parms )
    {
       switch ( cursor )
       {
             case 0 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 1 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 2 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 3 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 4 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 5 :
                stmt.SetParameter(1, (String)parms[0]);
                stmt.SetParameter(2, (short)parms[1]);
                break;
             case 7 :
                stmt.SetParameter(1, (String)parms[0]);
                stmt.SetParameter(2, (short)parms[1]);
                stmt.SetParameter(3, (short)parms[2]);
                break;
             case 8 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 9 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
       }
    }

 }

}
